﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using TrainingWorkshop.Model;

namespace TrainingWorkShop.CommonUtility
{
    /// <summary>
    /// This class implements Interface IEqualityComparer
    /// its function is to judge the equality of two student,which is a Model class
    /// </summary>
    public class StudentListEquality : IEqualityComparer<Student>
    {
        public bool Equals(Student x, Student y)
        {
            return x.StudentId == y.StudentId;
        }

        public int GetHashCode(Student obj)
        {
            if (obj == null)
            {
                return 0;
            }
            else
            {
                 return obj.ToString() .GetHashCode();
            }
        }
    }
}
